const mysql = require("mysql")

let pool = mysql.createPool({
    host: "localhost",
    user: "root",
    password: "123",
    database: "good-chinese-poetry"
})


module.exports = {
    query: (sql,condition) => {
        let p1 = new Promise((resolve, reject) => {
            pool.query(sql, condition,(err, results, fiedls) => {
                if (err) {
                    reject(err)
                } else {
                    resolve(results)
                }
            })
        })
        return p1

    }
}